<?php

namespace App\Http\Controllers\WorkOrder\Internal;

use App\Http\Controllers\BaseController;
use App\Service\WorkOrder\Appraise\AppraiseService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class AppraiseController extends BaseController
{
    public function getInfoByOrderNos(Request $request): JsonResponse
    {
        $this->validate(
            $request, [
                'workOrderNo' => 'required|array',
                'types'        => 'required|array',
            ]
        );
        return $this->success(AppraiseService::getInfoByOrderNos($request->workOrderNo, $request->types));
    }

    public function eventNotify(Request $request): JsonResponse
    {
        $this->validate(
            $request, [
                'workOrderNo' => 'required|string',
                'type'        => 'required|integer',
                'shopId'      => 'required|integer',
            ]
        );
        return $this->success(AppraiseService::checkEventNotify($request->workOrderNo, $request->shopId, $request->type));
    }
}
